<?php
        include './model/dao/conectarMssql.php';
        
        $con = ConeccionMssql::getConexion();
        $query = "SELECT * FROM prueba1";
                
        //execute the SQL statement and return records
        $rs = $con->execute($query);
        
        $nc = $rs->Fields->count();
        echo "numero de columnas =".$nc;
        
        //$nf = $rs->RecordCount();        
        //echo "numero de filas =".$nf;
        
        echo "<table border='1'>";
        if(rs) {
            echo "<tr>";
            for ($i=0; $i < $nc; $i++) {
                echo "<td>" . utf8_encode( $rs->Fields[$i]->Name) . "</td>";
            }
            echo "</tr>";
                
            while (!$rs->EOF)  //carry on looping through while there are records
            {
                echo "<tr>";
                for ($i=0; $i < $nc; $i++) {
                    echo "<td>" . utf8_encode( $rs->Fields[$i]->value) . "</td>";
                }
                echo "</tr>";
                $rs->MoveNext(); //move on to the next record
            }
        }
        echo "</table>";
        $rs->close();
        $con->close();
?>

